/**
 * 通义千问API接口定义
 */

/**
 * 多模态输入接口
 */
export interface MultimodalInput {
    id: string;
    text?: string;
    images?: Array<File | string>;
    audio?: Blob;
    video?: File;
    timestamp: number;
    contextId?: string;
    metadata?: Record<string, any>;
}

/**
 * 聊天角色类型
 */
export type ChatRole = 'user' | 'assistant' | 'system';

/**
 * 内容类型
 */
export type ContentType = 'text' | 'image' | 'audio' | 'video';

/**
 * 聊天消息内容项
 */
export interface ChatContentItem {
    type: ContentType;
    text?: string;
    image?: string;
    audio?: string;
    video?: string;
    image_url?: {
        url: string;
    };
}

/**
 * 聊天消息
 */
export interface ChatMessage {
    role: ChatRole;
    content: string | ChatContentItem[];
}

/**
 * 聊天完成选项
 */
export interface ChatCompletionOptions {
    model?: string;
    stream?: boolean;
    parameters?: {
        max_tokens?: number;
        temperature?: number;
        top_p?: number;
        top_k?: number;
        stop?: string[];
        seed?: number;
        presence_penalty?: number;
        frequency_penalty?: number;
    };
}

/**
 * 流式响应监听器
 */
export interface StreamResponseListeners {
    onText?: (text: string) => void;
    onImage?: (url: string) => void;
    onEnd?: () => void;
    onError?: (error: Error) => void;
}

/**
 * API错误类型
 */
export interface APIError {
    code: string;
    status: number;
    message: string;
    isRetryable: boolean;
} 